from pathlib import Path
from conf.config import CONFIG
def get_filepath(filepath=None,study_uid=None,series_uid=None):
    """
    """
    if not filepath and not study_uid:
        raise Exception("filepath与study_uid至少需要一个参数")
    if study_uid:
        loc = Path(CONFIG.orthanc_storage).joinpath(study_uid)
        if series_uid:
            loc = loc.joinpath(series_uid)
    else:
        loc = Path(filepath)
    files = []
    for x in loc.iterdir():
        if x.is_dir():
            for y in x.iterdir():
               files.append(y.resolve())
        else:
            files.append(x.resolve())
    return files